package cc.magicjson.synthesis.model;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.math.BigDecimal;

/**
 * 订单类，包含基本的订单信息
 */
@Getter
@Setter
@ToString
public class Order {
    private final String orderId;
    private final BigDecimal originalAmount; // 原始金额
    private BigDecimal finalAmount;    // 最终支付金额
    private BigDecimal discountAmount; // 优惠金额

    // 是否使用积分
    private boolean usePoints = true;
    // 是否使用优惠券
    private boolean useCoupon = true;

    // 用户信息
    private final User user;

    public Order(String orderId, BigDecimal amount, User user) {
        this.orderId = orderId;
        this.originalAmount = amount;
        this.finalAmount = amount; // 初始时最终金额等于原始金额
        this.discountAmount = BigDecimal.ZERO;
        this.user = user;
    }

}
